//
//  JoinDetailViewController.m
//  WideHelp
//
//  Created by ENERGY on 2018/8/7.
//  Copyright © 2018年 ENERGY. All rights reserved.
//首页-加入

#import "JoinDetailViewController.h"
#import "JoinDemandViewController.h"
@interface JoinDetailViewController ()

@end

@implementation JoinDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"计划详情";
    //添加控件
    [self setUpViews];
}
#pragma mark - init
- (void)setUpViews{
    UIButton * bottomBtn = [[UIButton alloc] init];
    [bottomBtn setBackgroundColor:getColor(greenBGColor)];
    [bottomBtn setTitle:@"" forState:UIControlStateNormal];
    bottomBtn.titleLabel.font = DEF_FontSize_16;
    [bottomBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [bottomBtn addTarget:self action:@selector(bottomBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [bottomBtn setBackgroundImage:[UIImage imageNamed:@"maself_bg"] forState:UIControlStateNormal];
    [self.view addSubview:bottomBtn];
    //立即加入
    UILabel * joinLab = [[UILabel alloc] init];
    [self label:joinLab withFont:DEF_FontSize_14 withText:@"立即加入" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentCenter withView:bottomBtn withBGColor:[UIColor clearColor]];
    //(也可以为家人加入)
    UILabel * addFamilyLab = [[UILabel alloc] init];
    [self label:addFamilyLab withFont:DEF_FontSize_12 withText:@"(也可以为家人加入)" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentCenter withView:bottomBtn withBGColor:[UIColor clearColor]];
    __weak typeof (self)weakSelf = self;
    [bottomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(weakSelf.view);
        make.bottom.equalTo(weakSelf.view.mas_bottom).mas_offset(-BOTTOM_HEIGHT);
        make.height.mas_offset(49/WIDTH_6_SCALE);
    }];
    [joinLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(bottomBtn);
        make.height.mas_offset(31/WIDTH_6_SCALE);
    }];
    [addFamilyLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(bottomBtn);
        make.top.equalTo(joinLab.mas_bottom);
        make.bottom.equalTo(bottomBtn.mas_bottom);
    }];
}

#pragma mark - action
- (void)bottomBtnClick:(UIButton *)sender{
    JoinDemandViewController * vc = [[JoinDemandViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}
@end
